<template>
	<view>

		<view class="bg padding">
			<view class="bigMarginTop"></view>
			<view class="lineGray1 line">
				<view class="lineBlack " style="flex-grow: 1;"></view>
				<view style="flex-grow: 3;"></view>
			</view>

			<input v-model="phone" class="underline-input marginTop3" focus placeholder="输入手机号码" />
			
	
			<button type="primary" v-show="name&&password" class="bigMarginTop" @click="register">下一步</button>
			<button v-show="!(name&&password)" class="bigMarginTop" @click="register">下一步</button>
			
			<view style="height: 100rpx;"></view>
			
			

			<view  @click="login">

				<view class="line">

					<view class="textblack14">已有账号?</view>
					<view class="textblue14">去登录</view>
				</view>


			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				cb: false,
				phone: "",
				btnType: "primary"
			}
		},
		onShareAppMessage(res) {
			return {
				title: '设辑-产品设计智能生成AI',
				path: '/pages/HomePage/HomePage',
				imageUrl: '/static/black-logo.png'
			}
		},
		// 自定义页面的分享到朋友圈
		onShareTimeline(res) {
			return {
				title: '设辑-产品设计智能生成AI',
				path: '/pages/HomePage/HomePage',
				imageUrl: '/static/black-logo.png'
			}
		},
		methods: {

			change(e) {
				console.log("e：" + e)
				if (e.detail.value.length > 0)
					this.cb = true
				else
					this.cb = false
			},

			forget: function() {

				console.log("check：" + this.cb)
			},
			register: function() {
				const that = this;
				
				if(!this.phone){
					uni.showToast({
						title:"请输入手机号码"
					})
					return
				}
			
				const url = getApp().globalData.apiUrl + "/api/v1/messagecode";
				
				uni.request({
					url: url,
					data: {
						phone: this.phone
						
					},
					method: 'POST',
					success: (res) => {
		
						console.log(res)
						if (res.data.code == 0) {
							uni.navigateTo({
								url: "/pages/Login/ComfirmPhone/ComfirmPhone?id="+res.data.data.id+"&phone="+that.phone+"&type=2"
							})
						} else {
							uni.showToast({
								icon: 'error',
								title: res.data.message
							})
						}
				
					}
				});

				
			},

			login: function() {
				console.log("login")
				uni.navigateTo({
					url: "/pages/Login/Login"
				})
			}
		}
	}
</script>

<style>
	@import url("../../common/uni.css");


	.register {
		width: 100%;
		margin-bottom: 15rpx;
		margin-top: 80rpx;
	}

	button[type=primary] {
		background-color: #282828;
	}


	.bigMarginTop {
		margin-top: 80rpx;
	}

	.image1 {
		width: 198.85px;
		height: 117.76px;
	}

	.image2 {
		width: 195.67px;
		height: 36.31px;
	}

	.image3 {
		margin-left: 100upx;
		width: 67.63px;
		height: 41.17px;
	}

	.bigText {
		font-size: 48px;
		font-weight: normal;
		line-height: 64px;
		text-align: center;
		letter-spacing: 0px;
		color: #000000;
	}

	.input1 {
		margin-top: 50upx;
		color: #FFFFFF;
	}

	.bg {
		height: 100vh;
		background-color: #FFFFFF;
	}
</style>